package com.study;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.cloud.netflix.zuul.filters.discovery.PatternServiceRouteMapper;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
//组合注解：注册到erueka：@EnableEurekaClient    所有请求子hystrix-command中执行：@EnableCircuitBreaker
@EnableZuulProxy
public class App {

	/**
	 * http://172.22.162.206:8040/v1/sunxj-microservice-provider-user/simple/1
	 */
	@Bean
	public PatternServiceRouteMapper serviceRouteMapper() {
		return new PatternServiceRouteMapper(
				"(?<name>^.+)-(?<version>v.+$)",
				"${version}/${name}");
	}

	public static void main(String[] args) {
		SpringApplication application = new SpringApplication(App.class);
		ConfigurableApplicationContext context = application.run(args);
		System.out.println("============end=======================");
	}

}
